package com.sbcb.properties.config;


import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


//@Configuration等价于@Configuration(proxyBeanMethods = true) //如果使用这个的话，对象是被代理过的，debug可以看到该对象有 EnhancerBySpringCGLIB
@Configuration(proxyBeanMethods = false) // 这个注入的bean没有被代理过
//@Component // 这个注入的bean没有被代理过
@ConfigurationProperties(prefix = "complicated.property")
public class ComplicatedProperty {
    private List<String> list = new ArrayList<>();
    private Map<String, String> map = new HashMap<>();
    private List<DatabaseSource> databaseSources = new ArrayList<>();

    public List<String> getList() {
        return list;
    }

    public void setList(List<String> list) {
        this.list = list;
    }

    public Map<String, String> getMap() {
        return map;
    }

    public void setMap(Map<String, String> map) {
        this.map = map;
    }

    public List<DatabaseSource> getDatabaseSources() {
        return databaseSources;
    }

    public void setDatabaseSources(List<DatabaseSource> databaseSources) {
        this.databaseSources = databaseSources;
    }

    @Override
    public String toString() {
        return "ComplicatedProperty{" +
                "list=" + list +
                ", map=" + map +
                ", databaseSources=" + databaseSources +
                '}';
    }
}
